<template>
    <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose title="视频预览" :height="880" cancelText="上一个"
        okText="下一个" @cancel="prev" @ok="next">
        <a-carousel ref="carousel" arrows :dots="false">
            <div v-for="url in videoList" :key="url">
                <video :src="url" controls="true"></video>
            </div>
            <template #prevArrow>
                <div class="custom-slick-arrow" style="left: 10px; z-index: 1">
                    <left-circle-outlined />
                </div>
            </template>
            <template #nextArrow>
                <div class="custom-slick-arrow" style="right: 10px">
                    <right-circle-outlined />
                </div>
            </template>
        </a-carousel>
        <template #footer>
            <div style="display: flex; justify-content: space-between;">
                <a-button @click="prev">上一个</a-button>
                <a-button color="success" @click="next">下一个</a-button>
            </div>
        </template>
    </BasicModal>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { LeftCircleOutlined, RightCircleOutlined } from '@ant-design/icons-vue';
// Emits声明
const emit = defineEmits(['register', 'success']);

const carousel = ref(null)
const videoList = ref([])
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
    // setModalProps({showCancelBtn: false, showOkBtn: false})
    videoList.value = data.list
})

const prev = () => {
    carousel.value?.prev()
}

const next = () => {
    carousel.value?.next()
}
</script>

<style scoped>
:deep(.slick-arrow.custom-slick-arrow) {
    width: 25px;
    height: 25px;
    font-size: 25px;
    color: #fff;
    background-color: rgba(31, 45, 61, 0.11);
    transition: ease all 0.3s;
    opacity: 0.3;
    z-index: 1;
}

:deep(.slick-arrow.custom-slick-arrow:before) {
    display: none;
}

:deep(.slick-arrow.custom-slick-arrow:hover) {
    color: #fff;
    opacity: 0.5;
}
</style>